<template>
  <el-space>

    <el-segmented v-model="type" :options="options"/>
    <el-button @click="_message">message</el-button>
    <el-button @click="_alert">alert</el-button>
    <el-button @click="_confirm">confirm</el-button>
  </el-space>
</template>

<script setup lang="ts">
import {$alert, $confirm, $message} from "../../morghulis/tools/feedback.ts";
import {ref} from "vue";
import type {UIFeedbackTypes} from "../../morghulis/types/morghulis.types.ts";

const type = ref<UIFeedbackTypes>('info')
const options = ref(["success", "info", "warning", "error"])


function _message() {
  $message[type.value]('hello world')
}

function _alert() {
  $alert[type.value]('hello world', 'Alert')
      .then(res => {
        console.log(res)
      })
}

function _confirm() {
  $confirm[type.value]('hello world', 'Alert')
      .then(res => {
        console.log(res)
      })
      .catch(res => {
        console.log(res)
      })
}

</script>

<style scoped>

</style>